<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    document.onkeydown = function (e) {
      e = e || window.event
      // 获取键盘键码的兼容写法
      var code = e.keyCode || e.which
      console.log(code)
      console.log(e.ctrlKey)

      if (e.ctrlKey && code === 83) {
        // s的键码是83
        console.log('同时按下了ctrl和s')
      }
    }
  </script>
</body>
</html>